package com.scwatch.core.repository;

import com.scwatch.core.domain.Info;
import com.scwatch.core.domain.InfoVote;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;

import java.util.List;

/**
 * Created by rh005 on 2017/7/26.
 */
public interface InfoVoteDao extends Repository<InfoVote,InfoVote.InfoVoteId> {
    public InfoVote findOne(InfoVote.InfoVoteId id);

    void delete(InfoVote entity);

    @Query("from Info bean join bean.infoVotes infoVote where infoVote.vote.id = ?1")
    public List<Info> findByInfoVoteVoteId(Integer voteId);
}
